﻿using System;
using LuaInterface;

public class UEngine_GameEventManagerWrap
{
	public static void Register(IntPtr L)
	{
		LuaMethod[] regs = new LuaMethod[]
		{
			new LuaMethod("Instance", Instance),
			new LuaMethod("RegisteHandle", RegisteHandle),
			new LuaMethod("UnRegisteHandle", UnRegisteHandle),
			new LuaMethod("PushEvent", PushEvent),
			new LuaMethod("Update", Update),
			new LuaMethod("New", _CreateUEngine_GameEventManager),
			new LuaMethod("GetClassType", GetClassType),
		};

		LuaField[] fields = new LuaField[]
		{
		};

		LuaScriptMgr.RegisterLib(L, "UEngine.GameEventManager", typeof(UEngine.GameEventManager), regs, fields, typeof(object));
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int _CreateUEngine_GameEventManager(IntPtr L)
	{
		int count = LuaDLL.lua_gettop(L);

		if (count == 0)
		{
			UEngine.GameEventManager obj = new UEngine.GameEventManager();
			LuaScriptMgr.PushObject(L, obj);
			return 1;
		}
		else
		{
			LuaDLL.luaL_error(L, "invalid arguments to method: UEngine.GameEventManager.New");
		}

		return 0;
	}

	static Type classType = typeof(UEngine.GameEventManager);

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int GetClassType(IntPtr L)
	{
		LuaScriptMgr.Push(L, classType);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int Instance(IntPtr L)
	{
		LuaScriptMgr.CheckArgsCount(L, 0);
		UEngine.GameEventManager o = UEngine.GameEventManager.Instance();
		LuaScriptMgr.PushObject(L, o);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int RegisteHandle(IntPtr L)
	{
		LuaScriptMgr.CheckArgsCount(L, 3);
		UEngine.GameEventManager obj = (UEngine.GameEventManager)LuaScriptMgr.GetNetObjectSelf(L, 1, "UEngine.GameEventManager");
		int arg0 = (int)LuaScriptMgr.GetNumber(L, 2);
		UEngine.GameEventDelegate arg1 = null;
		LuaTypes funcType3 = LuaDLL.lua_type(L, 3);

		if (funcType3 != LuaTypes.LUA_TFUNCTION)
		{
			 arg1 = (UEngine.GameEventDelegate)LuaScriptMgr.GetNetObject(L, 3, typeof(UEngine.GameEventDelegate));
		}
		else
		{
			LuaFunction func = LuaScriptMgr.GetLuaFunction(L, 3);
			arg1 = (param0) =>
			{
				int top = func.BeginPCall();
				LuaScriptMgr.PushValue(L, param0);
				func.PCall(top, 1);
				func.EndPCall(top);
			};
		}

		obj.RegisteHandle(arg0,arg1);
		return 0;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int UnRegisteHandle(IntPtr L)
	{
		LuaScriptMgr.CheckArgsCount(L, 3);
		UEngine.GameEventManager obj = (UEngine.GameEventManager)LuaScriptMgr.GetNetObjectSelf(L, 1, "UEngine.GameEventManager");
		int arg0 = (int)LuaScriptMgr.GetNumber(L, 2);
		UEngine.GameEventDelegate arg1 = null;
		LuaTypes funcType3 = LuaDLL.lua_type(L, 3);

		if (funcType3 != LuaTypes.LUA_TFUNCTION)
		{
			 arg1 = (UEngine.GameEventDelegate)LuaScriptMgr.GetNetObject(L, 3, typeof(UEngine.GameEventDelegate));
		}
		else
		{
			LuaFunction func = LuaScriptMgr.GetLuaFunction(L, 3);
			arg1 = (param0) =>
			{
				int top = func.BeginPCall();
				LuaScriptMgr.PushValue(L, param0);
				func.PCall(top, 1);
				func.EndPCall(top);
			};
		}

		obj.UnRegisteHandle(arg0,arg1);
		return 0;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int PushEvent(IntPtr L)
	{
		int count = LuaDLL.lua_gettop(L);

		if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(UEngine.GameEventManager), typeof(UEngine.GameEventParam)))
		{
			UEngine.GameEventManager obj = (UEngine.GameEventManager)LuaScriptMgr.GetNetObjectSelf(L, 1, "UEngine.GameEventManager");
			UEngine.GameEventParam arg0 = (UEngine.GameEventParam)LuaScriptMgr.GetLuaObject(L, 2);
			obj.PushEvent(arg0);
			return 0;
		}
		else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(UEngine.GameEventManager), typeof(int)))
		{
			UEngine.GameEventManager obj = (UEngine.GameEventManager)LuaScriptMgr.GetNetObjectSelf(L, 1, "UEngine.GameEventManager");
			int arg0 = (int)LuaDLL.lua_tonumber(L, 2);
			obj.PushEvent(arg0);
			return 0;
		}
		else if (count == 3)
		{
			UEngine.GameEventManager obj = (UEngine.GameEventManager)LuaScriptMgr.GetNetObjectSelf(L, 1, "UEngine.GameEventManager");
			int arg0 = (int)LuaScriptMgr.GetNumber(L, 2);
			object arg1 = LuaScriptMgr.GetVarObject(L, 3);
			obj.PushEvent(arg0,arg1);
			return 0;
		}
		else
		{
			LuaDLL.luaL_error(L, "invalid arguments to method: UEngine.GameEventManager.PushEvent");
		}

		return 0;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int Update(IntPtr L)
	{
		LuaScriptMgr.CheckArgsCount(L, 1);
		UEngine.GameEventManager obj = (UEngine.GameEventManager)LuaScriptMgr.GetNetObjectSelf(L, 1, "UEngine.GameEventManager");
		obj.Update();
		return 0;
	}
}

